# Contributor: Willow Barraco <contact@willowbarraco.fr>
# Maintainer: Willow Barraco <contact@willowbarraco.fr>
pkgname=avahi2dns
_commit=9349a6495ad4cafcd1d44e089b8ea2215165888e
pkgver=0.0.1_git20240102
pkgrel=2
pkgdesc="Small DNS server which interface with avahi"
url="https://github.com/LouisBrunner/avahi2dns"
arch="all"
license="MIT"
makedepends="go"
subpackages="$pkgname-openrc"
# no test suite available
options="!check net"
source="
	$pkgname-$_commit.tar.gz::https://github.com/LouisBrunner/avahi2dns/archive/$_commit.tar.gz
	avahi2dns.confd
	update-go-mod.patch
"
builddir="$srcdir/$pkgname-$_commit"

export GOPATH="$srcdir/go"
export GOCACHE="$srcdir/go-build"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	go build
}

package() {
	install -Dm755 avahi2dns "$pkgdir"/usr/bin/avahi2dns
	install -Dm755 openrc/avahi2dns "$pkgdir"/etc/init.d/avahi2dns
	install -Dm644 "$srcdir"/avahi2dns.confd "$pkgdir"/etc/conf.d/avahi2dns
}

sha512sums="
0506973b3bcd5e9bceb356167d373c3229af1fc5b20012bb6d532015f9a87737c763701904b5186ac9d0f40cb2c12524170a46c907b14c0543145ee73b7222d5  avahi2dns-9349a6495ad4cafcd1d44e089b8ea2215165888e.tar.gz
6b3c7af148b4734f4dfb53c74acd41ea0aba212cb01bac7be8e441a6d5514f539b3042b0bb8d17b1e0cdba60788aa8d4bd03a22206a2d37ab305a239cce32e96  avahi2dns.confd
1184e9172f4894f963bce6c7695732fc2d06bf92d9da9ac3a54d7909e557d8544359d6daf83a26e820dfa04f8673a0ebdf9f722e1d063b55bdfb0ac6708ead7c  update-go-mod.patch
"
